package Java实训.第三天JDK特性流;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Num3 {
    /*
     * 集合转换：[[1,2,3,4,5],[2,1,9,3,6,7],[3,1,6] ->
     * ["1","2","4","5","2",......""3*,"1","6"]
     */
    public static void main(String[] args) {
        ArrayList<ArrayList<Integer>> list = new ArrayList<>();
        ArrayList<Integer> list1 = new ArrayList<>();
        Collections.addAll(list1,1,2,3,4,5);
        ArrayList<Integer> list2 = new ArrayList<>();
        Collections.addAll(list2,2,1,9,3,6,7);
        ArrayList<Integer> list3 = new ArrayList<>();
       Collections.addAll(list3,3,1,6);
        Collections.addAll(list, list1,list2,list3);
        System.out.println("整体集合为: " + list);
        Stream<String> st = Stream
                .concat(list1.stream(), list2.stream())
                .map(s -> new String(String.valueOf(s)));
        List<String> list4 = Stream.concat(st, list3.stream())
                .map(s -> new String(String.valueOf(s)))
                .collect(Collectors.toList());
        System.out.println(list4);
    }
}
